package com.lqs.sofp.service.impl;

import com.lqs.sofp.dao.UserInfoDao;
import com.lqs.sofp.dao.impl.UserInfoDaoImpl;
import com.lqs.sofp.entity.User;
import com.lqs.sofp.service.UserService;

public class UserServiceImpl implements UserService {
    @Override
    public User login(String Username, String Password) {
        //参数传递测试，有传到loginService层
        System.out.println(Username+"\t"+Password+"参数成功传递到loginService层");

        //问题代码区：-》当参数传递到service层后，却没有往下到dao层进行传递！
        UserInfoDao userinfo = new UserInfoDaoImpl();
        User user = userinfo.select(Username);
        ///////////////////////////////////////////

        if (user != null){
            System.out.println(user.getUsername() + "\t" + user.getPassword() + "\t" + user.getPhone() + "\t" + user.getGender());
        }else{
            System.out.println("login---查无此人！");
        }
        //end test


        if (user != null) {
            if (user.getPassword().equals(Password)) {
                return user;
            }
        }
        return null;
    }
}
